﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/MasterPages/Blank.Master"
    AutoEventWireup="true" CodeBehind="KnowledgeList.aspx.cs" Inherits="DMS.Web.Modules.Knowledge.KnowledgeList" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="diy" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="server">
    档案管理有关规定
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainHolder" runat="server">
    <script type="text/javascript" src="/Resources/Scripts/jquery.blockUI.js"></script>
    <script type="text/javascript">
        var url = '/Modules/Knowledge/KnowledgeEdit.aspx';
        function addKnowledge() {
            window.open(url + '?mode=new', null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=900px,height=700px');

        }
        function editKnowledge(id) {
            window.open(url + '?mode=edit&id=' + id, null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=900px,height=700px');

        }

        function refresh() {
            document.getElementById("<%=queryBtn.ClientID %>").click();
        }

        function showKnowledge(id) {
            window.open('/Modules/Knowledge/KnowledgeView.aspx?id=' + id, null, 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=900px,height=700px');
        }

        function getHandler(r) {
            if (window.parent && window.parent != window) {                
                parent.getHandler(r);
            } else {
                $('#notice2').html(r.content);
                $('#title2').text(r.title);

                var fontsize = 25 - r.title.length / 5;
                if (fontsize <= 0)
                    fontsize = 10
                if (r.title.length > 15)
                    $('#title2').css("fontSize", fontsize);
                else if (r.title.length > 10)
                    $('#title2').css("fontSize", fontsize);
                else
                    $('#title2').css("fontSize", fontsize);
                $.blockUI({ message: $('#noticeArea2'),
                    timeout: 999999999,
                    css: {
                        theme: true,
                        left: ($(window).width() - 600) / 2 + 'px',
                        '-webkit-border-radius': '10px',
                        '-moz-border-radius': '10px',
                        opacity: 1
                    }
                });
            }
        }

        function hide() {
            $.unblockUI();
        }
    </script>
    <div class="search">
        <!----------- 查询信息 ------------------>
        <table width="94%" cellpadding="0" cellspacing="0">
            <tr>
                <td class="form">
                    <table cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <th width="50px">
                                <nobr>
                                        标题：
                                    </nobr>
                            </th>
                            <td width="85px">
                                <asp:TextBox ID="TitleQ" runat="server" Width="80px"></asp:TextBox>
                            </td>
                            <th width="50px">
                                <nobr>
                                        创建人：
                                    </nobr>
                            </th>
                            <td width="85px">
                                <asp:TextBox ID="PublisherQ" runat="server" Width="80px"></asp:TextBox>
                            </td>
                            <th width="280px">
                                <nobr>
                                        创建时间在：<asp:TextBox ID="PublishTimeQ1" onClick="WdatePicker()" runat="server" Width="80px"></asp:TextBox>-<asp:TextBox ID="PublishTimeQ2" onClick="WdatePicker()" runat="server" Width="80px"></asp:TextBox>之间
                                    </nobr>
                            </th>
                            <td class="button">
                                <nobr>
                                        <asp:LinkButton ID="queryBtn" runat="server" ToolTip="查询" OnClick="BtnQuery_Click"><img src="/Themes/Default/btn_search.gif" /></asp:LinkButton>
                                        <%if (String.IsNullOrEmpty(mode) || !mode.Equals("view"))
                                          { %>
                                        <span id="Span1" runat="server" candisplay="Management">
                                            <asp:LinkButton ID="addBtn" ToolTip="新建" OnClientClick="addKnowledge();return false;" runat="server"><img src="/Themes/Default/btn_new.GIF" /></asp:LinkButton>
                                        </span>
                                        <%} %>
                                    </nobr>
                            </td>
                        </tr>                      
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <%--数据列表--%>
    <asp:DataGrid ID="dataList" runat="server" AutoGenerateColumns="false" DataKeyField="KnowledgeID"
        Width="97%" CssClass="dg_borderstyle" OnItemCommand="OnCommand">
        <HeaderStyle HorizontalAlign="Center" />
        <ItemStyle CssClass="dg_itemstyle" />
        <AlternatingItemStyle CssClass="dg_alternatingitemstyle" />
        <Columns>
            <asp:TemplateColumn HeaderText="标题">
                <ItemStyle Width="340px" HorizontalAlign="left" />
                <ItemTemplate>
                    <nobr><%#Eval("Title")%></nobr>
                </ItemTemplate>
            </asp:TemplateColumn>          
            <asp:TemplateColumn HeaderText="创建人">
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                <ItemTemplate>
                    <nobr><%#Eval("Publisher")%></nobr>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="创建时间">
                <ItemStyle Width="50px" HorizontalAlign="Center" />
                <ItemTemplate>
                    <nobr><%#Eval("PublishTime")%></nobr>
                </ItemTemplate>
            </asp:TemplateColumn>           
            <asp:TemplateColumn HeaderText="操作" Visible="true">
                <ItemStyle HorizontalAlign="Center" Width="30px" />
                <ItemTemplate>
                    <nobr>
                        <a href=javascript:showKnowledge('<%#Eval("KnowledgeID") %>')>查看</a>
                        <%if(String.IsNullOrEmpty(mode) || !mode.Equals("view")){ %>
                        <a href=javascript:editKnowledge('<%#Eval("KnowledgeID") %>')>编辑</a>
                        <asp:LinkButton ID="DelCommandBtn" CommandName="Delete" onClientClick="javascript:return confirm('是否确认删除知识？')" runat="server">删除</asp:LinkButton>                                
                        <%} %>
                    </nobr>
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
    </asp:DataGrid>
    <diy:AspNetPager ID="pager" runat="server" AlwaysShow="true" OnPageChanged="pager_PageChanged"
        Width="97%" ShowPageIndexBox="Always" PageIndexBoxType="TextBox" TextBeforePageIndexBox="转到"
        TextAfterPageIndexBox="页" ShowCustomInfoSection="Left" CustomInfoHTML="总数：%RecordCount%，共 %PageCount% 页，当前为第%CurrentPageIndex%页"
        HorizontalAlign="right" FirstPageText="首页" PrevPageText="上页" NextPageText="下页"
        LastPageText="末页" CssClass="dg_pagestyle">
    </diy:AspNetPager>
    <div id="dvEmpty" runat="server" class="EmptyMsg" visible="false">
        没有查询到相应的知识信息。
    </div>
    <div id="noticeArea2" style="display: none;width:610px; height:450px; overflow:auto">
        <table style="width:100%">
            <tr>
                <td style="background-image:url(/Themes/Default/opinion_button.png);background-repeat:repeat; text-align:center">
                        <font id="title2" size="4" style="padding-right:25px" color="white"></font>
                        <img style="position:absolute;right:5px;cursor:hand;" width="25px" height="25px" onclick="hide();" src="/Resources/Images/pause.png" />
                </td>
            </tr>
            <tr>
                <td>
                    <div id="notice2" pageIndex="1" style="width:600px; height:350px; overflow:auto;">
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <table align="center">
                        <tr>
                            
                            <td>
                               <span id="Span8" runat="server">
                                    <input type="button" class="com_btn3" value="关闭" id="Button7" onclick="hide()" />
                                </span>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
